package com.les.ufcg.gerenciador.elementos;


import com.les.ufcg.gerenciador.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class RemoveActivity extends Activity implements OnItemClickListener {
	
	private ListView opcoesPrincipais;
	String[] main_items = {"Remover Emprestimo", "Remover todos os emprestimos", "Remover emprestimos cedidos"};
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //db = DBAdapter.getContext(this);
        
        opcoesPrincipais = (ListView)findViewById(R.id.main_list);
        opcoesPrincipais.setOnItemClickListener(this);
        opcoesPrincipais.setAdapter(new ArrayAdapter<String>(this, R.layout.remove_itens, main_items));
    }

    
	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
		
	  	switch(position) {
	  	
		    case 0: {
		    	Log.d("Listar", "Listar todos os Emprestimos");
		    	startActivity(new Intent(getApplication(), RemoverEmprestimosActivity.class));
	    	    break;
			}
	    
		    case 1: {
		    	Log.d("Listar", "Listar apenas os meus Emprestimos");
		    	startActivity(new Intent(getApplication(), RemoverTodosEmprestimosActivity.class));
	    	    break;
			}
		    case 2: {
		    	Log.d("Listar", "Listar emprestimos cedidos");
		    	startActivity(new Intent(getApplication(), RemoverTodosEmprestimosCedidosActivity.class));
	    	    break;
			}
	}
	}
}
    